home *** CD-ROM | disk | FTP | other *** search
- Path: news-m01.ny.us.ibm.net!usenet
- From: bbogard@ibm.net
- Newsgroups: comp.lang.c++
- Subject: Re: Operator Overloading
- Date: 8 Apr 1996 02:18:42 GMT
- Message-ID: <4k9t22$173k@news-s01.ny.us.ibm.net>
- References: <9604071905.AA001o6@lorelei.demon.co.uk>
- Reply-To: bbogard@ibm.net
- NNTP-Posting-Host: slip129-37-223-75.ca.us.ibm.net
- X-Newsreader: IBM NewsReader/2 v1.2.5
-
- >and it seems to allow me to say
- >
- > double x;
- >
- > x = MyClass;
- >
- >It seems to be a user-defined casting operator, but I can't find any
- >mention of this in any books I have. Can anyone explain what I have
- >discovered here?
- What you have discovered is a conversion operator. The compiler would use it to
- convert from one type of object to another. That is why your compiler can assign
- MyClass to x. It does it through the conversion operator.
-